package demoMod.stsconsole.rooms;

import demoMod.stsconsole.ConsoleEntry;
import demoMod.stsconsole.dungeons.AbstractDungeon;
import demoMod.stsconsole.interfaces.DropRewardSubscriber;
import demoMod.stsconsole.rewards.CardReward;
import demoMod.stsconsole.rewards.GoldReward;
import demoMod.stsconsole.rewards.PotionReward;

public class MonsterRoom extends AbstractRoom {
    public MonsterRoom() {
        this.phase = RoomPhase.COMBAT;
    }

    @Override
    public void onPlayerEntry() {
        super.onPlayerEntry();
        if (this.phase == RoomPhase.COMBAT) {
            this.enterCombat(AbstractDungeon.currDungeon.getEncounter(this));
        } else {
            dropReward();
        }
    }

    @Override
    public String getRoomSymbol() {
        return "M";
    }

    @Override
    public void dropReward() {
        if (this.shouldDropReward) {
            this.rewards.add(new CardReward());
            this.rewards.add(new GoldReward(this.goldAmount));
            if (AbstractDungeon.potionRng.nextBoolean(0.2F)) {
                this.rewards.add(new PotionReward());
            }
        }
        ConsoleEntry.triggerSubscribers(DropRewardSubscriber.class, "onDropReward",
                new Class[]{boolean.class}, new Object[]{this.shouldDropReward});
    }
}
